#include<iostream>
using namespace std;

#include<string>
#include<vector>
#include<list>

void test_string1()
{
	// 1.size | length
	string s1("hello string");
	// 两者一样的 但我们通常用size,size是通用的使用于链表二叉树等等
	cout << s1.size() << endl;
	cout << s1.length() << endl;
	cout << "————————————————————" << endl;
	// 2.max_size
	string s2;
	cout << s1.max_size() << endl;
	cout << s2.max_size() << endl;
	cout << "————————————————————" << endl;
	// 3.capacity
	cout << s1.capacity() << endl;
	cout << "————————————————————" << endl;
	// 4.clear
	string s3("hello clear");
	cout << "清空前：" << s3 << endl;
	cout << "容量：" << s3.capacity() << endl;
	s3.clear();
	cout << "清空后：" << s3 << endl;
	cout << "容量：" << s3.capacity() << endl;
	cout << "———————————————————————" << endl;
	// 5.reserve和resize
	//     保留    逆置
	// 查看扩容机制
	string s;
	s.reserve(100);

	size_t sz = s.capacity();
	cout << "capacity changed: " << sz << '\n';
	cout << "making s grow:\n";
	for (int i = 0; i < 100; ++i)
	{
		s.push_back('C');
		if (sz != s.capacity())
		{
			sz = s.capacity();
			cout << "capacity changed: " << sz << '\n';
		}
	}
}
void test_string2()
{
	string s1("hello string");
	s1.reserve(100);

	string s2("hello string");
	s2.resize(100);

	string s3;
	s3.resize(100, 'x'); // 给值，指定初始化字符

	string s4("hello world");
	s4.resize(5);
}
//int main()
//{
//	//test_string1();
//	test_string2();
//
//	return 0;
//}
#include<stdio.h>
int main()
{
	int a = 10;
	int b = 20;
	int e = a + b;
	e = e + 2;
	printf("%d\n", e);

	int q = 100;
	q = q + 2;
	printf("%d\n", q);
}